{template header}
<h4 style="padding-left:10px;;">
    <span>搜索</span>
    <i class="icon-search"></i>
    <span style="float: right;margin-top:-3px;margin-right:10px;"><a href="?c=admin&a=bbsPush" class="btn btn-link">添加</a></span>
</h4>
<form class="form-horizontal" method="post" action="">
    <div class="control-group search-group" style="margin:0;">
        <label class="control-label" >状态：</label>
        <div class="controls">
            <select name="status">
                <option value="-1">全部</option>
                {loop $pushStatus $key $val}
                <option value="{$key}" {if $status==$key}selected{/if}>{$val}</option>
                {/loop}
            </select>
        </div>
    </div>
    <div class="control-group search-group" style="margin:0;">
        <div class="controls">
            <button class="btn" type="submit">提交</button>
            <!-- <button class="btn" type="reset">重置</button> -->
        </div>
    </div>
</form>
<div class="bs-docs-example table-align pt-15" style="clear:both;">
    <table class="table table-striped table-align">
        <thead>
        <tr>
            <th>帖子ID</th>
            <th>帖子标题</th>
            <th>推送状态</th>
            <th>推送时间</th>
            <th>添加时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {loop $list $k $v}
        <tr>
            <td>{$v['news_id']}</td>
            <td>{$v['title']}</td>
            <td>{eval echo $pushStatus[$v['status']]}</td>
            <td>{if $v['push_time'] > 0}{eval echo date("Y-m-d H:i:s",$v['push_time'])}{/if}</td>
            <td>{eval echo date("Y-m-d H:i:s",$v['addtime'])}</td>
            <td>{if !$v['status']}<a class="btn btn-edit push-del" href="javascript:void(0);" data-id="{$v['id']}">删除</a>{/if}</td>
        </tr>

        {/loop}
        </tbody>
    </table>
</div>
<div class="pagination">
    <ul>
        {$pageStr}
    </ul>
</div>
<script type="text/javascript">
    $(function() {
       $('.push-del').on('click', function() {
            $.post(
                    '/admin/bbsPushList',
                    {'id': $(this).attr('data-id'), 'operate': 'del'},
                    function(data){
                            if (data.code == 0) {
                                    alert(data.msg); 
                                    location.reload();
                            } else {
                                    alert(data.msg);
                            }
                    },
                    'json'
            );
       }) 
    });
</script>
{template footer}
